/**
 * Created by Mikey on 2017/6/10.
 */

function doLogin() {
    var username = $('#username').val();
    var password = $('#password').val();
    if(username == ""||username == null){
        alert("请输入账号");
        return;
    }
    if(password == ""||password == null){
        alert("请输入密码");
        return;
    }
    $.ajax({
        url : "/doLogin.json",
        type : "POST",
        data : {
            username : username,
            password : password
        },
        success : function (ret){
            if(ret.msg == "success"){
                if(ret.data == "管理员"){
                    location.href = "/userManage.json"
                }else{
                    location.href = "/bookBorrow.json"
                }
            }else{

            }
        }
    })
}